
package cn.yogehaoren.badfox.core;

import cn.yogehaoren.badfox.http.BadFoxCookie;
import cn.yogehaoren.badfox.struct.Request;
import cn.yogehaoren.badfox.struct.Response;

import java.util.List;

public interface BadFoxDownloader {
    /**
     * 处理抓取请求生成response
     * @param request 请求
     * @return {@link Response} 封装响应对象
     * @throws Exception --
     */
    Response process(Request request) throws Exception;

    /**
     * 处理meta标签refresh场景
     *
     * @param nextUrl 重定向URL
     * @return 请求的最终返回体
     * @throws Exception --
     */
    Response metaRefresh(String nextUrl) throws Exception;

    /**
     * http请求状态
     * @return http状态码
     */
    int statusCode();

    /**
     * 添加自定义cookies
     * @param url 目标地址
     * @param badFoxCookies cookies
     */
    void addCookies(String url, List<BadFoxCookie> badFoxCookies);

}
